
//-------------------------
// Legislators as Lobbyists
// TABLE A9
//-------------------------

clear
use masterdata_house.dta

// generate demographic variables


gen whiteratio = white/population
gen blackratio = black/population
gen a1 = white/population
gen a2 = black/population
gen a3 = native/population 
gen a4 = asian/population
gen a5 = pacific/population
gen a6 = otherrace/population 
gen a7 = twomorerace/population
gen ethnic = 1 - (a1^2 + a2^2 + a3^2 + a4^2 + a5^2 + a6^2 + a7^2)
gen nohs = lessthanhs/pop_over25
gen hs = highschool/pop_over25 
gen loweredu = nohs + hs
gen college = bachelor/pop_over25
gen advanced = (master + professional + doctoral)/pop_over25
gen unemployment = pop_unemployed/pop_civilian


gen housecom =.
replace housecom = 1 if primary_committee == "Education and Labor"
replace housecom = 1 if primary_committee == "Education and Workforce"
replace housecom = 1 if primary_committee == "Education and the Workforce"
replace housecom = 0 if housecom ==. & house ==1

gen housecom2 =.
replace housecom2 = 1 if committee1 == "Education and Labor" 
replace housecom2 = 1 if committee2 == "Education and Labor" 
replace housecom2 = 1 if committee3 == "Education and Labor" 
replace housecom2 = 1 if committee4 == "Education and Labor"
replace housecom2 = 1 if committee1 == "Education and Workforce" 
replace housecom2 = 1 if committee2 == "Education and Workforce" 
replace housecom2 = 1 if committee3 == "Education and Workforce" 
replace housecom2 = 1 if committee4 == "Education and Workforce"
replace housecom2 = 1 if committee1 == "Education and the Workforce" 
replace housecom2 = 1 if committee2 == "Education and the Workforce" 
replace housecom2 = 1 if committee3 == "Education and the Workforce"
replace housecom2 = 1 if committee4 == "Education and the Workforce"
replace housecom2 = 0 if housecom2 ==. & house ==1

gen houtradecom = .
replace houtradecom = 1 if committee1 =="Ways and Means"
replace houtradecom = 1 if committee2 =="Ways and Means"
replace houtradecom = 1 if committee3 =="Ways and Means"
replace houtradecom = 1 if committee4 =="Ways and Means"
replace houtradecom = 0 if houtradecom == . & house ==1


replace medianincome = ln(medianincome+1)
replace publicunion = publicunion/100

encode state, gen(state2)

macro define member_char "housecom2 w_m_trade_subcom approp_labor_subcom wrkfrce_protec_subcom leadership trade_idealpoint1"
macro define district_char "whiteratio loweredu gini medianincome unemployment presdem_2008 change_china_exp l_manu_emp publicunion"


// regression
eststo clear
eststo: quietly reg  contact  $member_char $district_char ,  vce(cluster icpsr) 
eststo: quietly areg contact  $member_char $district_char i.congress, a(state2) vce(cluster icpsr)
eststo: quietly areg contactt $member_char $district_char , a(state2) vce(cluster icpsr)
eststo: quietly areg contactt $member_char $district_char i.congress, a(icpsr) vce(cluster icpsr)
esttab, star(* 0.1 ** 0.05 *** 0.01) ar2

